package cn.yiyuan.controller;

import cn.yiyuan.base.untli.AjaxResult;
import cn.yiyuan.domain.Emp;
import cn.yiyuan.domain.Employee;
import cn.yiyuan.service.ILonginService;
import cn.yiyuan.vo.LoginVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @user m
 * @project system_boog
 * @date 2023-10-17
 * @package cn.yiyuan.controller
 */
@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private ILonginService iLonginService;
    @PutMapping
    public AjaxResult login(@RequestBody Employee emp){
        try {
            LoginVO token = iLonginService.login(emp);
            return AjaxResult.success(token);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error(e.getMessage());
        }
    }
}
